package testMybatis;

import java.util.List;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.github.pagehelper.PageHelper;
import com.sitech.pojo.UserBean;
import com.sitech.service.IUserService;

@RunWith(SpringJUnit4ClassRunner.class)    
@ContextConfiguration(locations = {"classpath:spring-mybatis.xml"}) 
public class testMybatis {
	private static Logger logger = Logger.getLogger(testMybatis.class);
	
	@Resource(name="userServiceImpl")  
    public IUserService userService ;  
	 @Test  
	    public void test1() {  
		 	logger.debug("开始了");
		 	PageHelper ph = new PageHelper();
		 	ph.startPage(2, 1);
	        List<UserBean> user = userService.select();  
	         System.out.println(user.get(0).getUsername());  
	       /*  logger.info("值："+user.getUserName());  
	        logger.info(JSON.toJSONString(user));  */
	    }  
	/* public static void main(String[] args) {
		 UserBean user = userService.selectByID("1");  
         System.out.println(user.getUserName());  
	}*/
	 
}
